package com.sdjzu.wangfuying.disableautobrightness.bean.remote;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;

public class Package implements Serializable, Parcelable {

    public final static Parcelable.Creator<Package> CREATOR = new Creator<Package>() {


        @SuppressWarnings({
                "unchecked"
        })
        public Package createFromParcel(Parcel in) {
            return new Package(in);
        }

        public Package[] newArray(int size) {
            return (new Package[size]);
        }

    };
    private final static long serialVersionUID = 724299040549537234L;
    @SerializedName("packageName")
    @Expose
    private String packageName;
    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("size")
    @Expose
    private int size;

    protected Package(Parcel in) {
        this.packageName = ((String) in.readValue((String.class.getClassLoader())));
        this.name = ((String) in.readValue((String.class.getClassLoader())));
        this.size = ((int) in.readValue((int.class.getClassLoader())));
    }

    public Package() {
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this).append("packageName", packageName).append("name", name).append("size", size).toString();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(packageName).append(name).append(size).toHashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof Package) == false) {
            return false;
        }
        Package rhs = ((Package) other);
        return new EqualsBuilder().append(packageName, rhs.packageName).append(name, rhs.name).append(size, rhs.size).isEquals();
    }

    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(packageName);
        dest.writeValue(name);
        dest.writeValue(size);
    }

    public int describeContents() {
        return 0;
    }


}